<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/template/template.xhtml"
	xmlns:s="http://sduept.security.el/func">
	<ui:define name="head">
		<title>日报</title>
		<link rel="stylesheet"
			href="/resources/plugins/datatables/dataTables.bootstrap.css" />
		<style>
iframe {
	width: 100%;
	height: 600px;
}

.ui-datalist-empty-message {
	min-height: 100px;
}

.ui-datalist-content {
	min-height: 100px;
}

.faultForm:faultTime_input {
	width: 100px;
	!
	important;
}

#addFaultReportForm .ui-calendar>.ui-state-default {
	border: 0px;
}

.ui-button-icon-only .ui-button-text {
	padding: .3em;
	text-indent: -9999999px;
	height: 27px;
}

.redColor {
	color: red;
}

.greenColor {
	color: green;
}
</style>
	</ui:define>
	<ui:define name="content">
		<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
			<p:commandButton value="是" type="button"
				styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
			<p:commandButton value="否" type="button"
				styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
		</p:confirmDialog>
		<!-- 故障档案 -->
		<div class='full-center-content-scroll-noheader'>
			<div id="lineFaultPanel" class="tab-content no-padding">
				<div id="linefaultpan" class="chart tab-pane active">
					<p:confirmDialog id="confirmDialog" global="true" showEffect="fade"
						hideEffect="fade">
						<p:commandButton value="是" type="button"
							styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
						<p:commandButton value="否" type="button"
							styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
					</p:confirmDialog>
					<h:form id="form5">
						<p:growl id="msgs" showDetail="true" />
						<div class="box box-solid with-border">
							<div class="box-header">
								<p:commandButton value="选择设备" id="chooseBtn"
									style="margin-right:5px;display:none"
									actionListener="#{faultReportController.getEquipmentByStation()}">
									<p:ajax event="dialogReturn"
										listener="#{faultReportController.onFaultDeviceChosen}"
										update="faultDevice" />
								</p:commandButton>
								<div style="float: left; width: 150px">
									<div class="ui-inputgroup">
										<p:inputText placeholder="故障设备" id="faultDevice"
											value="#{faultReportController.faultDevice}"
											style="width:110px;" />
										<p:commandButton icon="fa fa-search"
											onclick="document.getElementById('form5:chooseBtn').click()"
											styleClass="white-button" style="height:28px" />
									</div>
								</div>
								<p:outputLabel value="是否故障：" />
								<h:selectOneMenu id="isFault"
									value="#{faultReportController.isFault}"
									style="width:80px;margin-right:10px;height:30px">
									<f:selectItem itemLabel="全部" itemValue="null" />
									<f:selectItem itemLabel="故障" itemValue="0" />
									<f:selectItem itemLabel="非故障" itemValue="1" />
								</h:selectOneMenu>
								<p:outputLabel value="电压等级：" />
								<h:selectOneMenu id="voltageLevel"
									value="#{faultReportController.selectedVoltage}"
									style="width:120px;margin-right:10px;height:30px">
									<f:selectItem itemLabel="全部" itemValue="" />
									<f:selectItem itemLabel="500kV及以上" itemValue="499" />
									<f:selectItem itemLabel="220kV" itemValue="220" />
								</h:selectOneMenu>
								<p:outputLabel for="popup7" value="故障时间：" />
								<p:calendar id="popup7" navigator="true"
									value="#{faultReportController.queryDate1}"
									pattern="yyyy-MM-dd" maxdate="Date()" size="12">
									<p:ajax event="dateSelect"
										listener="#{faultReportController.onDateSelectStart}" />
								</p:calendar>
								<p:outputLabel for="popup8" value="至 "
									style="margin-right:5px;margin-left:5px;" />
								<p:calendar id="popup8" navigator="true"
									value="#{faultReportController.queryDate2}"
									pattern="yyyy-MM-dd" maxdate="Date()" size="12">
									<p:ajax event="dateSelect"
										listener="#{faultReportController.onDateSelectEnd}" />
								</p:calendar>
								<p:commandButton value="查询" id="query2"
									update="linefault toolbar" icon="ui-icon-search"
									actionListener="#{faultReportController.queryByTime}"
									style="margin-left:10px;">
								</p:commandButton>
								<p:commandButton icon="ui-icon-refresh" value="重置"
									actionListener="#{faultReportController.resetQuery}"
									style="margin-left:5px;"
									update="chooseBtn faultDevice isFault voltageLevel popup7 popup8 toolbar linefault" />
							</div>
						</div>
						<p:toolbar id="toolbar">
							<f:facet name="left">
								<p:commandButton value="新建" icon="ui-icon-document"
									actionListener="#{faultReportController.preCreateFault}"
									rendered="#{s:hasPermission(session,'bhyx_gzfx_xj')}"
									oncomplete="PF('createFaultDialog').show()"
									update=":faultForm:createFaultDialog" />
								<p:commandButton value="编辑" icon="ui-icon-pencil"
									disabled="#{faultReportController.selectFaults == null or faultReportController.selectFaults.size()!=1}"
									actionListener="#{faultReportController.preEditFault}"
									rendered="#{s:hasPermission(session,'bhyx_gzfx_bj')}"
									update=":faultForm:createFaultDialog form5:msgs" />
								<p:commandButton value="删除" icon="ui-icon-trash"
									rendered="#{s:hasPermission(session,'bhyx_gzfx_sc')}"
									actionListener="#{faultReportController.deleteFault}"
									disabled="#{faultReportController.selectFaults == null or faultReportController.selectFaults.size()==0}"
									update="linefault form5:msgs form5:toolbar">
									<p:confirm header="提示" message="确定删除该记录吗?" icon="ui-icon-alert" />
								</p:commandButton>
								<p:commandButton id="uploadUnit" style="margin-left:10px;"
									icon="ui-icon-arrowthick-1-n" value="上传"
									actionListener="#{faultReportController.chooseEquipment}">
									<p:ajax event="dialogReturn"
										listener="#{faultReportController.onSelectorChosen}"
										update="linefault form5:msgs" />
								</p:commandButton>
								<p:commandButton value="导出故障详情" icon="ui-icon-arrowthick-1-s"
									rendered="#{s:hasPermission(session,'bhyx_gzda_dcgzxq')}"
									actionListener="#{faultReportController.exportFaultDetail()}"
									ajax="false">
									<p:fileDownload value="#{faultReportController.file}" />
								</p:commandButton>
								<p:commandButton value="故障锁定情况" icon="ui-icon-alert"
									oncomplete="PF('faultEditLockedInfo').show()"
									update="lockedForm:faultEditLockedInfo"
									rendered="#{s:hasPermission(session,'bhyx_gzda_gzsdqk')}"
									actionListener="#{faultEditLockedInfoController.init()}">
								</p:commandButton>
							</f:facet>
						</p:toolbar>
						<!-- 故障表格 -->
						<p:dataTable id="linefault" var="item"
							value="#{faultReportController.lineFaultsModel}"
							rowKey="#{item.id}" style="margin-bottom:0" emptyMessage="无记录"
							rows="20" paginator="true"
							paginatorTemplate="{Customization} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} 
								{LastPageLink} {RowsPerPageDropdown}"
							lazy="true" editable="true" editMode="cell" rowIndexVar="ite"
							selection="#{faultReportController.selectFaults}"
							rowsPerPageTemplate="20,30,50" paginatorPosition="bottom"
							liveResize="true" resizableColumns="true">
							<f:facet name="{Customization}">
								<p:outputLabel value="总计：#{faultReportController.count} 条记录"
									style="margin-right:20px;"></p:outputLabel>
							</f:facet>
							<p:ajax event="rowSelectCheckbox" update="form5:toolbar" />
							<p:ajax event="rowUnselectCheckbox" update="form5:toolbar" />
							<!-- <p:ajax event="rowSelect" update="form5:toolbar" /> -->
							<p:column selectionMode="multiple"
								style="width:8px;text-align:center" />
							<p:column width="10" headerText="序号 ">
								<h:outputText value="#{ite+1}" />
							</p:column>
							<p:column selectRow="false" width="30" headerText="故障时间 "
								style="text-align:center;">
								<h:outputText style="white-space:pre-wrap;"
									value="#{item.faultTime}">
									<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" />
								</h:outputText>
							</p:column>
							<p:column width="30" headerText="故障设备" style="text-align:center">
								<h:outputText style="white-space:pre-wrap;"
									value="#{item.equipment}" />
							</p:column>
							<p:column width="25" headerText="故障类型" style="text-align:center">
								<h:outputText style="white-space:pre-wrap;"
									value="#{item.faultType}" />
							</p:column>
							<p:column width="30" headerText="故障原因分类">
								<h:outputText style="white-space:pre-wrap;"
									value="#{item.faultReson}" />
							</p:column>
							<p:column width="15" headerText="相别" style="text-align:center">
								<h:outputText value="#{item.faultPhase}" />
							</p:column>
							<p:column width="50" headerText="行波测距">
								<h:outputText style="white-space:pre-wrap;"
									value="#{item.ranging}" escape="false" />
							</p:column>
							<p:column width="80" headerText="故障原因">
								<h:outputText style="white-space:pre-wrap;display:block;"
									value="#{item.thunderInfo}" escape="false" />
								<h:outputText style="white-space:pre-wrap;display:block;"
									value="#{item.iceInfo}" escape="false" />
								<h:outputText style="white-space:pre-wrap;display:block;"
									value="#{item.remark}" escape="false" />
							</p:column>
							<p:column width="105" headerText="故障过程">
								<h:outputText style="white-space:pre-wrap;"
									value="#{item.description}" escape="false" />
							</p:column>
							<p:column width="35" headerText="故障来源" style="text-align:center">
								<h:outputText rendered="#{null==item.source}" value="" />
								<h:outputText rendered="#{0==item.source}" value="人工创建" />
								<h:outputText rendered="#{1==item.source}" value="集中录波" />
								<h:outputText rendered="#{2==item.source}" value="保护录波" />
								<h:outputText rendered="#{3==item.source}" value="跳闸记录" />
								<h:outputText rendered="#{4==item.source}" value="调度日志" />
							</p:column>
							<p:column width="35" headerText="是否故障" style="text-align:center;">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText
											value="#{faultReportController.getStatusText(item.status)}" />
									</f:facet>
									<f:facet name="input">
										<h:selectOneMenu value="#{item.status}"
											style="margin-left:8px;width:80px;height:27px;color:black;background-color:white;">
											<f:selectItem itemLabel="故障" itemValue="0" />
											<f:selectItem itemLabel="非故障" itemValue="1" />
											<p:ajax event="change"
												listener="#{faultReportController.setSelectEdit(item)}"
												oncomplete="PF('confirmDialog').show()"></p:ajax>
										</h:selectOneMenu>
									</f:facet>
								</p:cellEditor>
							</p:column>
							<p:column width="35" headerText="是否推送" style="text-align:center;">
								<p:cellEditor>
									<f:facet name="output">
										<h:outputText rendered="#{item.push==1}" style="color:blue"
											value="#{faultReportController.getPushText(item.push)}" />
										<h:outputText rendered="#{item.push!=1}"
											value="#{faultReportController.getPushText(item.push)}" />
									</f:facet>
									<f:facet name="input">
										<h:selectOneMenu value="#{item.push}"
											style="margin-left:8px;width:80px;height:27px;color:black;background-color:white;">
											<f:selectItem itemLabel="推送" itemValue="0" />
											<f:selectItem itemLabel="不推送" itemValue="1" />
											<p:ajax event="change"
												listener="#{faultReportController.setSelectEdit(item)}"
												oncomplete="PF('confirmDialog').show()"></p:ajax>
										</h:selectOneMenu>
									</f:facet>
								</p:cellEditor>
							</p:column>
							<p:column headerText="报告" width="40" style="text-align: center"
								exportable="false">
								<p:commandLink style="color: red"
									styleClass="ui-commandlink ui-widget fa fa-map-o"
									disabled="#{item.equipment_id == null || (item.etype != '线路' &amp;&amp; item.etype != '母线' &amp;&amp; item.etype != '变压器')}"
									actionListener="#{faultReportController.checkEditPageAct(item)}"
									update="form5:msgs" />
								<p:commandLink style="color: red;margin-left:20px; "
									styleClass="ui-commandlink ui-widget fa fa-stack-overflow"
									actionListener="#{faultReportController.openFaultProcess(item)}"
									oncomplete="PF('faultProcessDialog').show()"
									update="form5:faultProcessPanel" />
							</p:column>
							<p:column headerText="录波文件" width="35" style="text-align: center"
								exportable="false">
								<p:commandLink styleClass="fa fa-upload"
									update="form5:msgs form5:uploadWaveFileDialog"
									actionListener="#{waveFileController.initByFault(item)}"
									rendered="#{s:hasPermission(session,'bhyx_gzfx_scwj')}"
									oncomplete="PF('uploadWaveFileDialog').show()" title="上传" />
								<p:commandLink styleClass="fa fa-download"
									update="form5:msgs downloadForm:downloadWaveFileDialog"
									style="margin-left:20px;" id="downloadBtn"
									rendered="#{s:hasPermission(session,'bhyx_gzfx_xz')}"
									oncomplete="PF('downloadWaveFileDialog').show()"
									actionListener="#{waveFileController.initByFault(item)}"
									title="下载">
								</p:commandLink>
							</p:column>
						</p:dataTable>
						<!-- 查看故障流程的dialog -->
						<p:dialog id="faultProcessDialog" widgetVar="faultProcessDialog"
							modal="true" header="故障分析" width="1400" height="600"
							closable="true">
							<p:outputPanel id="faultProcessPanel">
								<p:dataTable id="faultProcessTable"
									value="#{faultReportController.processNodes}" var="node"
									emptyMessage="无记录">
									<p:column headerText="名称">
										<h:outputText value="#{node.processNode.name}" />
									</p:column>
									<p:column headerText="详情">
										<h:outputText value="#{node.handlerLog.log}" />
									</p:column>
									<p:column headerText="序号">
										<h:outputText value="#{node.processNode.orderNo}" />
									</p:column>
								</p:dataTable>
								<p:dataTable id="faultSources" var="info"
									value="#{faultReportController.sourceInfos}" emptyMessage="无记录"
									style="text-align:center;margin-top:30px;">
									<p:columnGroup type="header">
										<p:row>
											<p:column width="100" rowspan="2" headerText="厂站" />
											<p:column rowspan="2" headerText="集中录波" />
											<p:column colspan="2" headerText="主一保护" />
											<p:column colspan="2" headerText="主二保护" />
											<p:column colspan="2" headerText="主三保护" />
											<p:column colspan="3" headerText="断路器保护一" />
											<p:column colspan="3" headerText="断路器保护二" />
										</p:row>
										<p:row>
											<p:column headerText="报文" />
											<p:column headerText="录波" />
											<p:column headerText="报文" />
											<p:column headerText="录波" />
											<p:column headerText="报文" />
											<p:column headerText="录波" />
											<p:column width="100" headerText="名称" />
											<p:column headerText="报文" />
											<p:column headerText="录波" />
											<p:column width="100" headerText="名称" />
											<p:column headerText="报文" />
											<p:column headerText="录波" />
										</p:row>
									</p:columnGroup>
									<p:column>
										<ui:repeat var="s" value="#{info.stationInfo}">
											<p:outputLabel style="width:100%;height:50%;"
												value="#{s.stationName}"></p:outputLabel>
										</ui:repeat>
									</p:column>
									<p:column>
										<ui:repeat var="s" value="#{info.stationInfo}">
											<p:outputLabel style="width:100%;height:50%;"
												styleClass="#{s.waveInfo ? 'greenColor':'redColor'}">#{faultReportController.getCentralizedStr(s.waveInfo)}</p:outputLabel>
										</ui:repeat>
									</p:column>
									<p:column>
										<ui:repeat var="s" value="#{info.stationInfo}">
											<p:outputLabel style="width:100%;height:50%;"
												styleClass="#{s.main1DatagramInfo ? 'greenColor':'redColor'}">#{faultReportController.getStateStr(s.main1DatagramInfo)}</p:outputLabel>
										</ui:repeat>
									</p:column>
									<p:column>
										<ui:repeat var="s" value="#{info.stationInfo}">
											<p:outputLabel style="width:100%;height:50%;"
												styleClass="#{s.main1WaveInfo ? 'greenColor':'redColor'}"
												value="#{faultReportController.getStateStr(s.main1WaveInfo)}" />
										</ui:repeat>
									</p:column>
									<p:column>
										<ui:repeat var="s" value="#{info.stationInfo}">
											<p:outputLabel style="width:100%;height:50%;"
												styleClass="#{s.main2DatagramInfo ? 'greenColor':'redColor'}">#{faultReportController.getStateStr(s.main2DatagramInfo)}</p:outputLabel>
										</ui:repeat>
									</p:column>
									<p:column>
										<ui:repeat var="s" value="#{info.stationInfo}">
											<p:outputLabel style="width:100%;height:50%;"
												styleClass="#{s.main2WaveInfo ? 'greenColor':'redColor'}">#{faultReportController.getStateStr(s.main2WaveInfo)}</p:outputLabel>
										</ui:repeat>
									</p:column>
									<p:column>
										<ui:repeat var="s" value="#{info.stationInfo}">
											<p:outputLabel style="width:100%;height:50%;"
												styleClass="#{s.main3DatagramInfo ? 'greenColor':'redColor'}">#{faultReportController.getStateStr(s.main3DatagramInfo)}</p:outputLabel>
										</ui:repeat>
									</p:column>
									<p:column>
										<ui:repeat var="s" value="#{info.stationInfo}">
											<p:outputLabel style="width:100%;height:50%;"
												styleClass="#{s.main3WaveInfo ? 'greenColor':'redColor'}">#{faultReportController.getStateStr(s.main3WaveInfo)}</p:outputLabel>
										</ui:repeat>
									</p:column>
									<p:column>
										<ui:repeat var="s" value="#{info.stationInfo}">
											<p:outputLabel title="#{s.breakerProtect1Name}"
												style="white-space:pre;overflow:hidden;text-overflow:ellipsis">#{s.breakerProtect1Name}</p:outputLabel>
										</ui:repeat>
									</p:column>
									<p:column>
										<ui:repeat var="s" value="#{info.stationInfo}">
											<p:outputLabel style="width:100%;height:50%;"
												styleClass="#{s.breakerProtect1DatagramInfo ? 'greenColor':'redColor'}">#{faultReportController.getStateStr(s.breakerProtect1DatagramInfo)}</p:outputLabel>
										</ui:repeat>
									</p:column>
									<p:column>
										<ui:repeat var="s" value="#{info.stationInfo}">
											<p:outputLabel style="width:100%;height:50%;"
												styleClass="#{s.breakerProtect1WaveInfo ? 'greenColor':'redColor'}">#{faultReportController.getStateStr(s.breakerProtect1WaveInfo)}</p:outputLabel>
										</ui:repeat>
									</p:column>
									<p:column>
										<ui:repeat var="s" value="#{info.stationInfo}">
											<p:outputLabel title="#{s.breakerProtect2Name}"
												style="white-space:pre;overflow:hidden;text-overflow:ellipsis">#{s.breakerProtect2Name}</p:outputLabel>
										</ui:repeat>
									</p:column>
									<p:column>
										<ui:repeat var="s" value="#{info.stationInfo}">
											<p:outputLabel style="width:100%;height:50%;"
												styleClass="#{s.breakerProtect2DatagramInfo ? 'greenColor':'redColor'}">#{faultReportController.getStateStr(s.breakerProtect2DatagramInfo)}</p:outputLabel>
										</ui:repeat>
									</p:column>
									<p:column>
										<ui:repeat var="s" value="#{info.stationInfo}">
											<p:outputLabel style="width:100%;height:50%;"
												styleClass="#{s.breakerProtect2WaveInfo ? 'greenColor':'redColor'}">#{faultReportController.getStateStr(s.breakerProtect2WaveInfo)}</p:outputLabel>
										</ui:repeat>
									</p:column>
								</p:dataTable>
							</p:outputPanel>
						</p:dialog>
						<!-- 修改故障状态dialog -->
						<p:dialog id="confirmDialog" widgetVar="confirmDialog"
							modal="true" header="提示" width="220" height="120"
							closable="false">
							 确定要修改故障状态吗？<br />
							<br />
							<br />
							<p:commandButton value="是" process="@form"
								styleClass="ui-confirmdialog-yes" icon="ui-icon-check"
								oncomplete="PF('confirmDialog').hide()"
								actionListener="#{faultReportController.editFaultStatus(faultReportController.selectEdit)}"
								update="form5:linefault form5:msgs" />
							<p:commandButton value="否" styleClass="ui-confirmdialog-no"
								icon="ui-icon-close" oncomplete="PF('confirmDialog').hide()"
								update="form5:linefault"
								actionListener="#{faultReportController.queryByTime}" />
						</p:dialog>
						<p:remoteCommand name="refreshTable" update="linefault" />
						<h:inputHidden value="#{fileUploadManagerController.oid}" />
						<!-- 上传录波文件 -->
						<p:dialog widgetVar="uploadWaveFileDialog"
							id="uploadWaveFileDialog" header="录波文件上传" modal="true"
							width="900" height="620" onHide="refreshTable();">
							<p:outputPanel id="waveFilePanel">
								<table style="width: 100%">
									<tr>
										<td><small><span class="fa fa-warning"
												style="color: #f39c12" /> 上传录波文件时，应选择与之对应的录波设备，并<b>同时上传.cfg和.dat文件</b>。右侧可选择全部录波设备。
												<br /> <span class="fa fa-warning" style="color: #f39c12" />
												如果不是本次故障的录波文件，系统将会系统生成错误的故障数据。 </small></td>
										<td><p:selectBooleanButton style="float:right"
												value="#{waveFileController.showRelatedEquipment}"
												onLabel="全部录波设备" offLabel="相关录波设备">
												<p:ajax update="waveFilePanel"
													listener="#{waveFileController.changeWaveEquipmentList}" />
											</p:selectBooleanButton></td>
									</tr>
								</table>
								<p:dataTable id="waveEquipmentTable" var="we"
									value="#{waveFileController.getCurrentWaveEquipmentList('')}"
									selection="#{waveFileController.selectedWaveEquipment}"
									selectionMode="single" rowKey="#{we.id}" emptyMessage="无记录"
									sortBy="#{we.subName}">
									<p:ajax event="rowSelect"
										update="form5:uploadCom form5:uploadMsg form5:waveFilePanel"
										listener="#{waveFileController.onWaveEquipmentRowSelect}" />
									<p:ajax event="rowUnselect"
										update="form5:uploadCom form5:uploadMsg form5:waveFilePanel"
										listener="#{waveFileController.onWaveEquipmentRowUnSelect}" />
									<p:column groupRow="true" headerText="变电站">
										<h:outputText value="#{we.subName}" />
									</p:column>
									<p:column headerText="类型">
										<h:outputText
											value="#{waveFileController.getWaveEquipmentType(we)}" />
									</p:column>
									<p:column headerText="录波器">
										<h:outputText value="#{we.name}" />
									</p:column>
								</p:dataTable>
								<p:separator />
								<p:fileUpload multiple="true" id="uploadCom"
									disabled="#{waveFileController.selectedWaveEquipment==null}"
									invalidFileMessage="文件扩展名必须是dat或者cfg"
									allowTypes="/(\.|\/)(((c|C)(f|F)(g|G))|((d|D)(a|A)(t|T)))$/"
									label="选择" uploadLabel="上传" cancelLabel="取消"
									fileUploadListener="#{waveFileController.handleWaveFileUpload}"
									fileLimit="2" sequential="true" fileLimitMessage="文件个数必须是2个"
									mode="advanced" update="form5:msgs  uploadMsg waveFilePanel" />
								<p:outputLabel id="uploadMsg" style="color:red;font-size:16px;"
									escape="false" value="#{waveFileController.uploadMsg}" />
								<br />
								<p:commandLink id="reBtn" value="继续上传"
									style="font-size:16px;color:#0080FF;margin-left:5px;"
									rendered="#{waveFileController.btnAvailable()}"
									actionListener="#{waveFileController.reUploadFile}"
									update="form5:msgs    uploadMsg waveFilePanel" />
								<p:commandLink id="cancleBtn" value="取消上传"
									style="font-size:16px;color:#0080FF;margin-left:30px;"
									rendered="#{waveFileController.btnAvailable()}"
									actionListener="#{waveFileController.cancleUpload}"
									update="form5:msgs uploadMsg waveFilePanel" />
								<br />
							</p:outputPanel>
						</p:dialog>
					</h:form>
					<h:inputHidden value="#{faultReportController.selectEdit}" />
				</div>
			</div>
		</div>
		<h:form id="noteForm">
			<p:dialog header="提示" widgetVar="noticeDialog" modal="true"
				resizable="false" height="100" width="350" closable="true">
				<p:outputLabel value="大数据系统未找到此设备，是否要继续保存此故障！" />
				<hr />
				<p:commandButton value="确定"
					actionListener="#{faultReportController.continueSaveFault}"
					icon="ui-icon-check" update="form5:linefault form5:msgs" />
				<p:commandButton value="取消" style="margin-left:5px"
					onclick="PF('noticeDialog').hide()" icon="ui-icon-close" />
			</p:dialog>
		</h:form>
		<!-- 编辑故障弹窗 -->
		<h:form id="faultForm">
			<p:dialog widgetVar="calendarDialog" header="时间选择" modal="true"
				resizable="false" id="calendarDialog" width="280" closable="false">
				<p:calendar id="c" mode="inline"
					value="#{faultReportController.faultDate}" pattern="yyyy-MM-dd"
					navigator="true">
					<p:ajax event="dateSelect"
						listener="#{faultReportController.onDateSelect}"
						update="faultTime" />
				</p:calendar>
				<div style="padding-top: 5px">
					<div style="float: left">
						<p:selectOneMenu id="h" style="width:74px;text-align:center"
							value="#{faultReportController.hour}">
							<p:ajax event="change"
								listener="#{faultReportController.onTimeChange}"
								update="faultTime" />
							<f:selectItem itemLabel="00" itemValue="00" />
							<f:selectItems value="#{faultReportController.getHours()}" />
						</p:selectOneMenu>
					</div>
					<span style="float: left; margin: 3px; font-weight: bold">:</span>
					<div style="float: left">
						<p:selectOneMenu id="m" style="width:74px"
							value="#{faultReportController.minute}">
							<p:ajax event="change"
								listener="#{faultReportController.onTimeChange}"
								update="faultTime" />
							<f:selectItem itemLabel="00" itemValue="00" />
							<f:selectItems
								value="#{faultReportController.getMinutesOrSeconds()}" />
						</p:selectOneMenu>
					</div>
					<span style="float: left; margin: 3px; font-weight: bold">:</span>
					<div style="float: left">
						<p:selectOneMenu id="s" style="width:74px"
							value="#{faultReportController.second}">
							<p:ajax event="change"
								listener="#{faultReportController.onTimeChange}"
								update="faultTime" />
							<f:selectItem itemLabel="00" itemValue="00" />
							<f:selectItems
								value="#{faultReportController.getMinutesOrSeconds()}" />
						</p:selectOneMenu>
					</div>
				</div>
				<p:commandButton value="确定" oncomplete="PF('calendarDialog').hide()"
					actionListener="#{faultReportController.sameFaultTip}"
					update="faultForm:sameFauleDialog" />
			</p:dialog>
			<p:dialog id="sameFauleDialog" widgetVar="sameFauleDialog"
				header="相似故障提示" modal="true" width="900">
				<p:outputLabel style="color:red;">以下为相似故障，请确认无误后填写。</p:outputLabel>
				<p:dataTable id="sameFaultTable"
					value="#{faultReportController.samefaults}" var="item">
					<p:column selectRow="false" width="45" headerText="故障时间 "
						style="text-align:center;">
						<h:outputText style="white-space:pre-wrap;"
							value="#{item.faultTime}">
							<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" />
						</h:outputText>
					</p:column>
					<p:column width="35" headerText="故障设备" style="text-align:center">
						<h:outputText style="white-space:pre-wrap;"
							value="#{item.equipment}" />
					</p:column>
					<p:column width="25" headerText="故障类型" style="text-align:center">
						<h:outputText style="white-space:pre-wrap;"
							value="#{item.faultType}" />
					</p:column>
					<p:column width="30" headerText="故障原因分类">
						<h:outputText style="white-space:pre-wrap;"
							value="#{item.faultReson}" />
					</p:column>
					<p:column width="15" headerText="相别" style="text-align:center">
						<h:outputText value="#{item.faultPhase}" />
					</p:column>
					<p:column width="60" headerText="行波测距">
						<h:outputText style="white-space:pre-wrap;"
							value="#{item.ranging}" escape="false" />
					</p:column>
					<p:column width="80" headerText="故障原因">
						<h:outputText style="white-space:pre-wrap;display:block;"
							value="#{item.thunderInfo}" escape="false" />
						<h:outputText style="white-space:pre-wrap;display:block;"
							value="#{item.iceInfo}" escape="false" />
						<h:outputText style="white-space:pre-wrap;display:block;"
							value="#{item.remark}" escape="false" />
					</p:column>
					<p:column width="80" headerText="故障过程">
						<h:outputText style="white-space:pre-wrap;"
							value="#{item.description}" escape="false" />
					</p:column>
					<p:column width="35" headerText="故障来源" style="text-align:center">
						<h:outputText rendered="#{null==item.source}" value="" />
						<h:outputText rendered="#{0==item.source}" value="人工创建" />
						<h:outputText rendered="#{1==item.source}" value="集中录波" />
						<h:outputText rendered="#{2==item.source}" value="保护录波" />
						<h:outputText rendered="#{3==item.source}" value="跳闸记录" />
						<h:outputText rendered="#{4==item.source}" value="调度日志" />
					</p:column>
				</p:dataTable>
				<br />
				<br />
				<p:commandButton value="确定"
					oncomplete="PF('sameFauleDialog').hide()" />
			</p:dialog>
			<p:dialog widgetVar="createFaultDialog" header="故障管理" modal="true"
				id="createFaultDialog" width="900">
				<p:messages id="noteMessage" showDetail="true" closable="true" />
				<p:toolbar>
					<f:facet name="left">
						<p:commandButton value="保存" icon="ui-icon-disk"
							actionListener="#{faultReportController.saveFault}"
							update="form5:linefault form5:msgs noteMessage  form5:toolbar" />
					</f:facet>
				</p:toolbar>
				<p:panelGrid id="panel" style="width:100%">
					<p:row>
						<p:column>
							<h:outputText value="*故障设备:" />
						</p:column>
						<p:column>
							<p:inputText id="equipment_text"
								disabled="#{!faultReportController.create}"
								value="#{faultReportController.selected.equipment}">
								<p:ajax event="change"
									listener="#{faultReportController.sameFaultTip}"
									update="faultForm:sameFauleDialog" />
							</p:inputText>
							<p:commandButton value="选择设备"
								rendered="#{faultReportController.create}" process="@this"
								style="margin-left:5px;"
								actionListener="#{faultReportController.getEquipmentByStation()}">
								<p:ajax event="dialogReturn"
									listener="#{faultReportController.onAnologSelectorChosen}"
									update="panel omsRow form5:msgs faultForm:sameFauleDialog editBtn" />
							</p:commandButton>
						</p:column>
						<p:column>
							<h:outputText value="*设备类型 :" />
						</p:column>
						<p:column>
							<p:autoComplete id="equipment_type"
								disabled="#{!faultReportController.create}"
								value="#{faultReportController.selected.etype}"
								onkeyup="updateStation();"
								completeMethod="#{faultReportController.completeEtype}"
								scrollHeight="400" dropdown="true">
								<p:ajax event="itemSelect"
									listener="#{faultReportController.selecteTypeItem}"
									update="station2 station2Label :phaseForm:faultPhaseBox2" />
							</p:autoComplete>
						</p:column>
					</p:row>
					<p:row id="row2">
						<p:column>
							<h:outputText value="*变电站 ：" />
						</p:column>
						<p:column>
							<p:autoComplete id="station1"
								disabled="#{!faultReportController.create}"
								value="#{faultReportController.selected.stationName}"
								completeMethod="#{controllerUtil.completeCimStation500}"
								scrollHeight="400" dropdown="true">
								<p:ajax event="itemSelect"
									listener="#{faultReportController.onStartStationSelect}" />
							</p:autoComplete>
						</p:column>
						<p:column>
							<h:outputText id="station2Label" value="变电站2：" />
						</p:column>
						<p:column>
							<p:autoComplete id="station2"
								disabled="#{!faultReportController.create || !faultReportController.showStation2}"
								value="#{faultReportController.selected.stationName2}"
								completeMethod="#{controllerUtil.completeCimStation500}"
								scrollHeight="400" dropdown="true">
								<p:ajax event="itemSelect"
									listener="#{faultReportController.onEndStationSelect}" />
							</p:autoComplete>
						</p:column>
					</p:row>
					<p:row>
						<p:column>
							<h:outputText value="*设备电压（kV）:" />
						</p:column>
						<p:column>
							<p:autoComplete id="faultVoltages_text"
								value="#{faultReportController.selected.voltage}"
								completeMethod="#{faultReportController.completeVoltage}"
								scrollHeight="400" dropdown="true" />
						</p:column>
						<p:column>
							<h:outputText value="*故障时间 :" />
						</p:column>
						<p:column>
							<p:inputText id="faultTime" onclick="PF('calendarDialog').show()"
								autocomplete="off"
								value="#{faultReportController.selected.faultTime}">
								<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" />
								<p:ajax event="click" update="c h m s"
									listener="#{faultReportController.preChangeFaultTime}" />
								<p:ajax event="change"
									listener="#{faultReportController.sameFaultTip}"
									update="faultForm:sameFauleDialog" />
							</p:inputText>
						</p:column>
					</p:row>
					<p:row>
						<p:column>
							<h:outputText value="*故障相别 :" />
						</p:column>
						<p:column>
							<p:inputText autocomplete="off" id="faultPhase_text"
								value="#{faultReportController.selected.faultPhase}">
								<p:ajax event="focus"
									oncomplete="PF('chooseFaultPhase2').show()"
									update=":phaseForm:faultPhaseBox2" />
							</p:inputText>
						</p:column>
						<p:column>
							<h:outputText value="调度单位:" />
						</p:column>
						<p:column>
							<p:inputText id="dispatchUnitText"
								value="#{faultReportController.dispatchUnit}"
								disabled="#{!faultReportController.create}" />
							<p:commandButton icon="ui-icon-pencil"
								style="margin-left:5px;width:28px" id="editBtn"
								disabled="#{faultReportController.selected.equipment == null}"
								actionListener="#{faultReportController.preEditLedger()}"
								oncomplete="PF('editDlg').show()" update=":editForm:editDlg" />
						</p:column>
					</p:row>
					<p:row>
						<p:column>
							<h:outputText value="故障类型:" />
						</p:column>
						<p:column>
							<p:autoComplete
								value="#{faultReportController.selected.faultType}"
								completeMethod="#{faultReportController.completeFaultTypeList}"
								scrollHeight="400" dropdown="true">
							</p:autoComplete>
						</p:column>
						<p:column>
							<h:outputText value="故障原因分类:" />
						</p:column>
						<p:column>
							<p:autoComplete
								value="#{faultReportController.selected.faultReson}"
								completeMethod="#{controllerUtil.complateFaultReason}"
								scrollHeight="400" dropdown="true" />
						</p:column>
					</p:row>
					<p:row id="omsRow"
						rendered="#{faultReportController.isAclineFault(faultReportController.selected)}">
						<p:column>
							<h:outputText value="是否推送到OMS服务" />
						</p:column>
						<p:column colspan="3">
							<p:selectBooleanCheckbox
								value="#{faultReportController.selected.sendToOms}" />
							<p:outputLabel style="color:red;margin-left:30px;"
								rendered="#{faultReportController.OMSInfo != null}"
								value="备注：#{faultReportController.OMSInfo}" />
						</p:column>
					</p:row>
					<p:row>
						<p:column>
							<h:outputText value="故障过程:" />
						</p:column>
						<p:column colspan="3">
							<p:inputTextarea rows="5"
								value="#{faultReportController.selected.description}"
								autoResize="false" style="width:100%" />
						</p:column>
					</p:row>
					<p:row>
						<p:column>
							<h:outputText value="智能分析" />
						</p:column>
						<p:column colspan="3">
							<h:outputText
								rendered="#{faultReportController.selected.thunderInfo != null }"
								rows="#{faultReportController.selected.iceInfo == null? 6:3}"
								style="width:100%;display:block;"
								value="#{faultReportController.selected.thunderInfo}"
								escape="false" />
							<h:outputText
								rendered="#{faultReportController.selected.iceInfo != null }"
								rows="#{faultReportController.selected.thunderInfo == null? 6:3}"
								style="width:100%;display:block"
								value="#{faultReportController.selected.iceInfo}" escape="false" />
						</p:column>
					</p:row>
					<p:row>
						<p:column>
							<h:outputText value="故障原因（人工巡线结果）:" />
						</p:column>
						<p:column colspan="3">
							<p:inputTextarea rows="6"
								value="#{faultReportController.selected.remark}"
								style="width:100%" autoResize="false" />
						</p:column>
					</p:row>
				</p:panelGrid>
			</p:dialog>
		</h:form>
		<h:form id="phaseForm">
			<!-- 选择故障相别 -->
			<p:dialog widgetVar="chooseFaultPhase2" header="选择故障相别" modal="true"
				id="chooseFaultPhase2" width="360" height="150" style="align:center"
				resizable="false">
				<p:toolbar>
					<f:facet name="left">
						<p:commandButton value="保存" icon="ui-icon-disk"
							actionListener="#{faultReportController.setupFaultPhase}"
							update=":faultForm:faultPhase_text "
							oncomplete="PF('chooseFaultPhase2').hide()" />
					</f:facet>
				</p:toolbar>
				<p:panelGrid columns="2" style="width:100%">
					<h:outputText value="相别:" />
					<p:selectManyCheckbox id="faultPhaseBox2" layout="grid" columns="3"
						value="#{faultReportController.selectedPhase}">
						<f:selectItems value="#{faultReportController.phases}" />
					</p:selectManyCheckbox>
				</p:panelGrid>
			</p:dialog>
		</h:form>
		<h:form id="editForm">
			<p:dialog widgetVar="editDlg" id="editDlg" width="500px"
				height="400px" header="设备管理单位维护">
				<p:toolbar>
					<f:facet name="left">
						<p:commandButton value="确定"
							update=":faultForm:dispatchUnitText :form5:msgs "
							icon="ui-icon-disk" oncomplete="PF('editDlg').hide()"
							actionListener="#{faultReportController.initDispatchUnit()}" />
						<p:commandButton value="取消" icon="ui-icon-disk"
							oncomplete="PF('editDlg').hide()" />
					</f:facet>
				</p:toolbar>
				<p:outputPanel style="width:100%;">
					<p:panelGrid style="width:100%;">
						<p:row>
							<p:column>
								<h:outputText value="设备名称" />
							</p:column>
							<p:column>
								<p:inputText value="#{faultReportController.ledger.name}"
									readonly="true" />
							</p:column>
						</p:row>
						<p:row>
							<p:column>
								<h:outputText value="调度单位" />
							</p:column>
							<p:column>
								<p:inputText id="orgDept"
									value="#{faultReportController.ledger.dispatchUnit}"
									readonly="true" />
								<p:commandButton value="选择" style="margin-left:5px"
									actionListener="#{ledgerQueryDataController.getDesorgDepartDialog()}">
									<p:ajax event="dialogReturn"
										listener="#{faultReportController.onDesorgDepartChosen}"
										update="orgDept" />
								</p:commandButton>
							</p:column>
						</p:row>
						<p:row>
							<p:column>
								<h:outputText value="资产归属" />
							</p:column>
							<p:column>
								<p:autoComplete scrollHeight="300" dropdown="true"
									value="#{faultReportController.ledger.assetOwner}"
									completeMethod="#{ledgerQueryDataController.completeAssetOwnerWhenEdit}" />
							</p:column>
						</p:row>
						<p:row>
							<p:column>
								<h:outputText value="运维单位" />
							</p:column>
							<p:column>
								<p:inputText id="opCompanyDept"
									value="#{faultReportController.ledger.maintenanceUnit}"
									readonly="true" />
								<p:commandButton value="选择" style="margin-left:5px"
									actionListener="#{ledgerQueryDataController.getOpDepartDialog()}">
									<p:ajax event="dialogReturn"
										listener="#{faultReportController.onOpDepartChosen}"
										update="secondary primary opCompanyDept unitType" />
								</p:commandButton>
							</p:column>
						</p:row>
						<p:row>
							<p:column>
								<h:outputText value="单位类型" />
							</p:column>
							<p:column>
								<p:autoComplete scrollHeight="300" dropdown="true"
									style="width:75%"
									value="#{faultReportController.ledger.unitType}" id="unitType"
									completeMethod="#{ledgerQueryDataController.completeUnitType}" />
							</p:column>
						</p:row>
						<p:row>
							<p:column>
								<h:outputText value="一次设备检修范围" />
							</p:column>
							<p:column>
								<p:inputText id="primary"
									value="#{faultReportController.ledger.primaryEquipmentScope}" />
							</p:column>
						</p:row>
						<p:row>
							<p:column>
								<h:outputText value="一次设备检修范围备注" />
							</p:column>
							<p:column>
								<p:inputText
									value="#{faultReportController.ledger.primaryEquipmentScopeRemark}" />
							</p:column>
						</p:row>
						<p:row>
							<p:column>
								<h:outputText value="二次设备检修范围" />
							</p:column>
							<p:column>
								<p:inputText id="secondary"
									value="#{faultReportController.ledger.secondaryEquipmentScope}" />
							</p:column>
						</p:row>
						<p:row>
							<p:column>
								<h:outputText value="二次设备检修范围备注" />
							</p:column>
							<p:column>
								<p:inputText
									value="#{faultReportController.ledger.secondaryEquipmentScopeRemark}" />
							</p:column>
						</p:row>
					</p:panelGrid>
				</p:outputPanel>
			</p:dialog>
		</h:form>
		<h:form id="lockedForm">
			<p:dialog widgetVar="faultEditLockedInfo" id="faultEditLockedInfo"
				header="故障锁定情况" modal="true" width="800" height="600">
				<p:toolbar>
					<f:facet name="left">
						<p:commandButton value="刷新" icon="ui-icon-refresh"
							actionListener="#{faultEditLockedInfoController.init()}"
							update="lockedForm:lockedTable" />
					</f:facet>
				</p:toolbar>
				<p:dataTable id="lockedTable" paginator="true" rows="10"
					value="#{faultEditLockedInfoController.lockedFaults}" var="item"
					rowKey="#{item.fault.id}" paginatorPosition="bottom"
					emptyMessage="没有故障被锁定" rowIndexVar="ite">
					<p:column width="60" headerText="序号">
						<h:outputText value="#{ite+1}" />
					</p:column>
					<p:column headerText="故障时间">
						<h:outputText value="#{item.fault.faultTime}">
							<f:convertDateTime pattern="yyyy-MM-dd hh:mm:ss" />
						</h:outputText>
					</p:column>
					<p:column headerText="故障设备">
						<h:outputText value="#{item.fault.equipment}" />
					</p:column>
					<p:column headerText="占有人">
						<h:outputText value="#{item.lockData.owner}" />
					</p:column>
					<p:column>
						<p:commandButton value="解除锁定" update="lockedTable"
							icon="ui-icon-close"
							actionListener="#{faultEditLockedInfoController.delocking(item.fault)}">
							<p:confirm header="提示" message="确定解锁该记录吗?" icon="ui-icon-alert" />
						</p:commandButton>
					</p:column>
				</p:dataTable>
			</p:dialog>
		</h:form>
		<!-- 录波文件下载 -->
		<h:form id="downloadForm">
			<p:dialog widgetVar="downloadWaveFileDialog" position="top"
				id="downloadWaveFileDialog" header="录波文件下载" style="margin-top:50px;"
				modal="true" width="900" height="620">
				<p:outputPanel id="waveFilePanel">
					<table style="width: 100%">
						<tr>
							<td style="font-size: 16px; margin-left: 5px;">以下是本次故障所关联的故障录波文件,
								<p:commandLink
									style="font-size:16px;color:#0080FF;margin-left:5px;"
									value="点击下载" ajax="false"
									disabled="#{waveFileController.getWaveFileByStationId('').size()==0}"
									actionListener="#{waveFileController.prepareDownloadFile('')}">
									<p:fileDownload value="#{waveFileController.downloadFile}" />
								</p:commandLink>
							</td>
						</tr>
					</table>
					<p:dataTable id="sWaveFileTable" var="item"
						value="#{waveFileController.getWaveFileByStationId('')}"
						rowKey="#{item.id}" emptyMessage="无记录" rowIndexVar="ite">
						<f:facet name="header">
						     录波文件
						</f:facet>
						<p:column width="2" headerText="序号 " style="text-align:center">
							<h:outputText value="#{ite+1}" />
						</p:column>
						<p:column width="10" headerText="时间">
							<h:outputText value="#{item.triggerSecond.substring(0,19)}">
							</h:outputText>
						</p:column>
						<p:column width="10" headerText="变电站名称">
							<h:outputText value="#{item.stationName}" />
						</p:column>
						<p:column width="10" headerText="装置">
							<h:outputText value="#{item.equipment}" />
						</p:column>
						<p:column width="50" headerText="录波文件">
							<h:outputText value="#{item.path}" />
						</p:column>
						<p:column width="10" headerText="文件来源">
							<h:outputText rendered="#{item.dataSource == 0}" value="系统获取" />
							<h:outputText rendered="#{item.dataSource == 1}" value="人工上传" />
						</p:column>
					</p:dataTable>
				</p:outputPanel>
			</p:dialog>
		</h:form>
	</ui:define>
	<ui:define name="contentend">
		<script>
			function openFaultReport(path) {
				if (path) {
					layer.open({
						type : 2,
						maxmin : false,
						area : [ '90%', '90%' ],
						fixed : false, //不固定
						title : '故障报告',
						maxmin : true,
						content : path,
					});
				}
			}
		</script>
	</ui:define>
</ui:composition>
